package com.usian.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usian.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface UserMapper extends BaseMapper<User> {

    public void insertUser(User user);

    List<User> findAll();

    @Select("select * from user where id = #{id}")
    User findById(Integer id);

    @Delete("delete from user where id = #{id}")
    void deleteById(Integer id);

    @Update("UPDATE `p10`.`user` SET `name` = #{name}, `sex` = #{sex}, `age` = #{age}, `birth` = #{birth} WHERE `id` = #{id}")
    void update(User user);
}
